﻿Public Class GamePlaySetting

    Private _option As SetGamePlayOption
    Public ReadOnly Property [Option] As SetGamePlayOption
        Get
            Return _option
        End Get
    End Property

    Public Sub Load(stream As IO.StreamReader)

        Dim shouldExit As Boolean = False
        Dim data As LineData

        Do Until shouldExit OrElse stream.EndOfStream
            data = ReadLineData(stream)

            Select Case data.LineType

                Case DataLineType.StartBlock

                    Select Case data.BlockName
                        Case "setgameplayoptions"
                            _option = New SetGamePlayOption
                            _option.Load(stream)
                        Case Else
                            AddUnmanagedLine(data.OriginalText)
                    End Select

                Case DataLineType.KeyValue

                    Select Case data.KeyValueData.Key
                        Case Else
                            AddUnmanagedLine(data.OriginalText)
                    End Select

                Case DataLineType.InLine
                    AddUnmanagedLine(data.OriginalText)

                Case DataLineType.StarBlockChar
                    ' skip
                Case DataLineType.EndBlockChar
                    shouldExit = True
                Case Else
                    AddUnmanagedLine(data.OriginalText)
            End Select
        Loop
    End Sub

End Class
